s=input()
s1=''
for a in s:
    if (a=='('or a=='{'or a=='[' or a=='<') or s1=='':
        s1+=a
    elif s1!='':
        if  (a==')' and s1 [-1]=='(') or (a=='}' and s1[-1]=='{') or (a==']' and s1[-1]=='[') or (a=='>' and s1[-1]=='<'):
            s1=s1[:-1]
if s1=='':
    print('true')
else:
    print('false')